package com.yw.common.core.db.proxy;

import java.sql.Connection;
import java.sql.PreparedStatement;

import com.yw.common.core.db.IDBConnection;
import com.yw.common.core.db.exception.DBCloseException;
import com.yw.common.core.db.exception.DBCommitException;
import com.yw.common.core.db.exception.DBException;
import com.yw.common.core.db.exception.DBOpenException;
import com.yw.common.core.db.exception.DBOpenTransException;
import com.yw.common.core.db.exception.DBRollBackException;
import com.yw.common.core.db.impl.SqlserverConnectionImpl;

/**
 * SqlServer数据库连接代理
 * @author aoshiguchen
 * @time 2015-09-01
 */

public class SqlserverConnectionProxy implements IDBConnection{
	
	private SqlserverConnectionImpl impl;
	
	public SqlserverConnectionProxy(SqlserverConnectionImpl impl){
		this.impl = impl;
	}
	
	@Override
	public void close() throws DBCloseException {
		impl.close();
	}

	@Override
	public void commit() throws DBCommitException {
		impl.commit();
	}

	@Override
	public boolean isClosed() throws DBException {
		
		return impl.isClosed();
	}

	@Override
	public Connection open() throws DBOpenException {
		
		return impl.open();
	}

	@Override
	public void openTrans() throws DBOpenTransException {
		impl.openTrans();
	}

	@Override
	public PreparedStatement prepareStatement(String sql) throws DBException {
		
		return impl.prepareStatement(sql);
	}

	@Override
	public void rollBack() throws DBRollBackException {
		impl.rollBack();
	}

}
